<if condition="IS_AJAX">
	<volist name="list" id="vo">
        <div class="col-xs-12 span-hover task" data-id="{$vo.id}">
        	<span class="col-xs-5">{$vo.title}</span>
        	<span class="col-xs-2">{$vo.integralNum}</span>
        	<span class="col-xs-3">{$vo.creator_name}</span>
        	<span class="col-xs-2"><?= $vo['status']==1?'完成':'进行中' ?></span>
        </div>
    </volist>
<else/>
<include file="Public:header" /> <include file="Public:navgation" />
<div class="container-fluid main-content"> 
  <div class="page-title chart-container"> </div>
  <div class="row">
    <div class="col-md-12">
      <div class="widget-container">
            <div class="heading"> 
                <i class="icon-bar-chart"></i>任务管理
                <if condition="getAccessMenu($accessList, 'Intesys', 'Task', 'insert')&&!isMobile()"> 
                	<a class="pull-right" onClick="_openWindow('{:U('add')}',500, '创建任务', '提交',ajaxReload,'')" href="#">添加</a> 
                </if>
            </div>  
        <div class="widget-content modal-open">
            <script type="text/javascript">
				function transStatu(statu){return statu==1?'完成':'未完成';}
            	//树状列表的图标
              glyph_opts = {
                map: {
                  doc: "glyphicon glyphicon-folder-close",
                  docOpen: "glyphicon glyphicon-folder-open",
                  expanderClosed: "icon-angle-right",
                  expanderLazy: "icon-angle-right",  // glyphicon-plus-sign
                  expanderOpen: "icon-angle-down",  // glyphicon-collapse-down
                  loading: "glyphicon glyphicon-refresh glyphicon-spin"
                }
              };
			  //树状列表显示
              $(function(){
					$("#treetable").fancytree({
					  extensions: ["glyph", "table"],
					  glyph: glyph_opts,
					  source: {url: "__URL__/getTask", debugDelay: 1000},
					  table: {
						nodeColumnIdx: 1
					  },
					  activate: function(event, data) {
						  	$(".fancytree-active .fancytree-expander").click();//点击展开
					  },
					  lazyLoad: function(event, data) {
						data.result = {url: "__URL__/getTask", debugDelay: 1000};
					  },
					  //表里的数据
					  renderColumns: function(event, data) {
						var node = data.node,
						  $tdList = $(node.tr).find(">td");
						  $(node.tr).addClass('DataListItem');
						$tdList.eq(0).text(node.getIndexHier());
						$tdList.eq(1).width(150);
						$tdList.eq(2).text(node.data.integralNum);
						$tdList.eq(3).text(node.data.remark);
						$tdList.eq(4).text(node.data.executor_name);
						$tdList.eq(5).text(node.data.reviewer_name);
						$tdList.eq(6).text(format(Number(node.data.datetime)));
						$tdList.eq(7).text(transStatu(node.data.status));
						var look='<div class="text-center actions BottomOptionBtn"><a class="table-actions button" href="#" onClick="_openWindow(\\\'__URL__/view/id/'+node.data.id+'\\\',500, \\\'查看任务\\\', \\\'取消\\\',null,\\\'\\\')"><i class="icon-eye-open"></i>查看</a>';
						var edit='<a class="table-actions update button" href="#" onClick="_openWindow(\\\'__URL__/edit/id/'+node.data.id+'\\\',500, \\\'修改任务\\\', \\\'提交\\\',ajaxReload,\\\'\\\')" ><i class="icon-pencil"></i>修改</a>';
						var dele='<a class="delete-row table-actions button" onClick="getReload(\\\'__URL__/delete/id/'+node.data.id+'\\\')" href="#" row="'+node.data.id+'"><i class="icon-trash"></i>删除</a></div>';
						$tdList.eq(8).html(look+edit+dele);
					  }
					});
              });
			  
            </script>
            <table id="treetable" class="table table-striped  dataTable DataListItem CustomerList">
              <thead>
                <tr class="hidden-xs">
                  <th class="hidden-xs">节点</th>
                  <th>名称</th>
                  <th>积分</th>
                  <th class="hidden-md">备注</th>
                  <th>执行人</th>
                  <th class="hidden-sm">审核人</th>
                  <th class="hidden-xs">时间</th>
                  <th>状态</th>
                  <th class="hidden-xs"></th>
                </tr>
              </thead>
              <tr>
              	<td class="hidden-xs"></td>
                <td></td>
                <td></td>
                <td class="hidden-md hidden-xs"></td>
                <td></td>
                <td class="hidden-xs"></td>
                <td class="hidden-xs"></td>
                <td></td>
                <td class="hidden-xs"></td> 
              </tr>
            </table>
         
        </div>

      </div>
    </div>
  </div>
</div>
<script>
function ajaxReload(){
	var form=$("#validate-form");//提交表单
	$.post(form.attr("action"),form.serialize(),function(data){if(data.statu==0){console.log(data.info);}},'json');
	$("#treetable").fancytree("getTree").reload();//刷新页面内容
}
function getReload(url){
	$.getJSON(url,{},function(){$("#treetable").fancytree("getTree").reload();});//异步提交链接并更新主内容
}
//显示 选择公司员工 的窗口
function showMemberRadioView(classname){
	var classname=classname||'executor_id';
	_openWindow('{:U('Member/getMemberGroupRadio')}',500, '选择员工', '确定',function(){setInputValue(classname);},'');
}

</script> 
<include file="Public:footer" />
</if>